package com.fsds.crem.web.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.fsds.crem.core.util.ApplicationUtils;
import com.fsds.crem.web.dao.UsersDao;
import com.fsds.crem.web.entity.Users;
import com.fsds.crem.web.service.UsersService;

@Service
public class UsersServiceImpl implements UsersService {

	@Resource
	private UsersDao usersDao;
	
	@Override
	public Users checkUser(Users users) {
		
		// 密码加密转换
		users.setPassword(ApplicationUtils.md5Hex(users.getPassword()));
		
		return usersDao.checkUser(users);
	}

	@Override
	public Users findById(Long userId) {
		
		return usersDao.getById(userId);
	}

	@Override
	public boolean findUsersIsExist(Users users) {
		
		List<Users> userList = usersDao.getList(users);
		
		if(userList != null && userList.size() > 0){
			return true;
		}
		
		return false;
	}

}
